#pragma once
#include <QMainWindow>
#include <list>
#include <vector>
#include <QListWidget>
#include <QMenu>



// file info
struct FileInfo
{
    const static int kInvalidIndex = -1;
    QString qstrFullPath;
    QString qstrFilename;
    QString qstrFilepath;
    bool ParseFromPath()
    {
        auto nPos = qstrFullPath.lastIndexOf('/');
        if(kInvalidIndex != nPos)
        {
            qstrFilename = qstrFullPath.mid(++nPos);
            qstrFilepath = qstrFullPath.mid(0, nPos);
            return true;
        }
        return false;
    }

};

QT_BEGIN_NAMESPACE
namespace Ui { class MyPlayer; }
QT_END_NAMESPACE

class MyPlayer : public QMainWindow
{
    Q_OBJECT

public:
    MyPlayer(QWidget *parent = nullptr);
    ~MyPlayer();

private:
    void init_signal();

private slots:
    void on_btnPre_clicked();

    void on_btnPlay_clicked();

    void on_btnNext_clicked();

    void on_btnStop_clicked();

    void on_listFile_DBClick_item(QListWidgetItem* pItem);

    void onCustomContextMenuRequested(const QPoint& ptMouse);

    void on_listFile_menu_delete();

    void on_listFile_menu_open();



private:
    bool eventFilter(QObject *pObject, QEvent *pEvent);


private:
    bool check_file_exist(const FileInfo& infoFile);

private:
    Ui::MyPlayer *ui;
    std::vector<FileInfo> m_vecFile;





};

